#coding=utf8

from flask_middlewares import Middleware
from .cookies import save_cookies
from .flash import save_flashs, load_flashs


class CookieMiddleware(Middleware):
    def before_request(self):
        load_flashs()

    def after_request(self, response):
        save_flashs()
        return save_cookies(response)
